import React from 'react';
import Route from 'react-router/lib/Route';
import { WeaLocaleProvider, WeaErrorPage } from 'ecCom';
import { IndexRoute } from 'react-router';

import './style';
import stores from './stores';

import Home from './components/Home';
import LoginComponent from './components/LoginComponent';
import SendFormComponent from './components/SendFormComponent';

import FieldSet from './page/fieldSet';
import UnitSet from './page/unitSet';
import Nav from './page/Nav';
import AlterLog from './page/LogCenter/alterLog';
import LogCenter from './page/LogCenter/logCenter';
import RecPostLog from './page/LogCenter/recPostLog';
import LoginLog from './page/LogCenter/loginLog';
import ChangePassword from './page/changePassword';
import ReceiveDocManage from './page/receiveDocManage';
import PostDocManage from './page/postDocManage';
import CorrespondFieldComp from './components/EditUnit/CorrespondFieldComp';
import AccountList from './page/accountList';


const getLabel = WeaLocaleProvider.getLabel;
class Error extends React.Component {
  render() {
    return (
      <WeaErrorPage ecId={`${this && this.props && this.props.ecId || ''}_WeaErrorPage@f7t79p`} msg={getLabel(384713, '对不起，无法找到该页面！')} />
    );
  }
}

const getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'odoc_exchange');

const Routes = (
  <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@oqalpp`} path="odocExchange" component={Home}>
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@zk02zv`} path="/" component={LoginComponent} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@dehhnc`} path="LoginComponent" component={LoginComponent} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@1uwa8v`} path="SendFormComponent" component={SendFormComponent} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@dfckv5`} path="field" component={CorrespondFieldComp} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@5nb2rf`} path="Nav" onEnter={getLocaleLabel} component={Nav} >
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@c2olp8`} path="fieldSet" breadcrumbName="字段设置" component={FieldSet} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@8p99on`} path="unitSet" breadcrumbName="单位设置" component={UnitSet} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@49homc`} path="logCenter" breadcrumbName="日志中心" component={LogCenter}>
        <IndexRoute ecId={`${this && this.props && this.props.ecId || ''}_IndexRoute@39uvmq`} component={LoginLog} />
        <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@vy2ul2`} path="loginLog" breadcrumbName="登录日志" component={LoginLog} />
        <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@xfkniv`} path="recPostLog" breadcrumbName="收发文日志" component={RecPostLog} />
        <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@58o7sx`} path="alterLog" breadcrumbName="变更日志" component={AlterLog} />
      </Route>
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@r2cwc3`} path="changePassword" breadcrumbName="修改密码" component={ChangePassword} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@mq9499`} path="receiveDocManage" breadcrumbName="收文管理" component={ReceiveDocManage} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@452sra`} path="postDocManage" breadcrumbName="发文管理" component={PostDocManage} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@w6mm2m`} path="postDocAccount" breadcrumbName="发文台账" component={AccountList} />
    </Route>
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@jqiyg1`} path="*" breadcrumbName="错误页面" component={Error} />
  </Route>
);


module.exports = {
  Route: Routes,
  store: stores,
};

